package org.spacetrader.seam2project.model;

import java.util.List;

import org.hibernate.Session;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.spacetrader.seam2project.model.entity.Person;

@Name("personService")
public class PersonService {
	@In
	private Session hibernateSession;
	
	public void savePerson(Person person) {
		hibernateSession.saveOrUpdate(person);
	}
	
	public List<Person> getPersonList() {
		@SuppressWarnings("unchecked")
		List<Person> results = hibernateSession.createCriteria(Person.class)
				.list();
		
		return results;
	}
}
